﻿using Collection.Entities;
using Super.Collection.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Itfort;


namespace Super.Collection.Services
{
    public class LotteryDetailsService : ServiceBase, ILotteryDetailsService
    {
        /// <summary>
        /// 插入一条中奖明细
        /// </summary>
        /// <param name="details"></param>
        public void Insert(LotteryDetails details)
        {
            this.DbSession.Save<_LotteryDetails>(details.Convert2<_LotteryDetails>());
        }

        /// <summary>
        /// 根据公告编号和中奖级别获取相应的中奖详情信息
        /// </summary>
        /// <param name="briefingId">公告编号</param>
        /// <param name="rewardLevels">中奖级别</param>
        /// <returns></returns>
        public LotteryDetails Get(long briefingId, int rewardLevels)
        {
            return this.DbSession.Single<_LotteryDetails>(_LotteryDetails._.BriefingId == briefingId
                            && _LotteryDetails._.RewardLevels == rewardLevels)
                    .Convert2<LotteryDetails>();
        }
    }
}
